<template>
  <view class="page">
    <view :style="{ height: statusBarHeight + 'px' }"></view>

    <view class="nav-bar">
      <view class="nav-left" @tap="goBack">
        <text class="fa fa-chevron-left fa-gray"></text>
      </view>
      <view class="nav-title">消息通知</view>
    </view>

    <scroll-view scroll-y class="content">
      <view class="message-list">
        <view class="message-item">
          <text
            class="fa fa-bell-o message-icon message-icon-rose fa-red"
          ></text>
          <view class="message-content">
            <text class="message-title">培训任务提醒</text>
            <text class="message-text"
              >ICU新人培训今晚 19:30 开始，请提前 10 分钟签到。</text
            >
          </view>
          <text class="message-time">刚刚</text>
        </view>

        <view class="message-item">
          <text
            class="fa fa-envelope-o message-icon message-icon-rose fa-blue"
          ></text>
          <view class="message-content">
            <text class="message-title">考试成绩发布</text>
            <text class="message-text"
              >内科住培阶段考试已出分，点击查看详情与排名。</text
            >
          </view>
          <text class="message-time">2 小时前</text>
        </view>

        <view class="message-item">
          <text
            class="fa fa-info-circle message-icon message-icon-rose fa-amber"
            style="color: rgb(217 119 6)"
          ></text>
          <view class="message-content">
            <text class="message-title">系统通知</text>
            <text class="message-text"
              >本周平台将进行版本更新，届时可能出现短时维护。</text
            >
          </view>
          <text class="message-time">昨天</text>
        </view>
      </view>
    </scroll-view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      statusBarHeight: 0,
    };
  },
  onLoad() {
    const systemInfo = uni.getSystemInfoSync();
    this.statusBarHeight = systemInfo.statusBarHeight || 0;
  },
  methods: {
    goBack() {
      uni.navigateBack();
    },
  },
};
</script>

<style scoped>
.page {
  min-height: 100vh;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
}

.nav-bar {
  height: 44px;
  background-color: #ffffff;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.nav-left {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.nav-title {
  font-size: 17px;
  font-weight: 600;
  color: #000000;
}

.icon {
  font-size: 20px;
}

.content {
  flex: 1;
  padding: 12px 16px;
  box-sizing: border-box;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-item {
  background-color: #ffffff;
  border: 1px solid #f3f4f6;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  gap: 12px;
}

.message-icon {
  font-size: 20px;
  margin-top: 2px;
}

.message-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-title {
  font-size: 14px;
  font-weight: 500;
  color: #111827;
}

.message-text {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
}

.message-time {
  font-size: 12px;
  color: #9ca3af;
  margin-left: auto;
}
</style>

